<?php
include_once("gateway/tdgProyecto.php");
$tdg = new tdgProyecto();
$row = null;
$dts = null;
if(isset ($_POST['opcion']) && isset ($_POST['palabra'])) {
    $opcion_ = $_POST['opcion'];
    $palabra_ = $_POST['palabra'];

    if($opcion_== 1) {
        $dts = $tdg->selectXNombre("%".$palabra_."%");
    }else {
        if($opcion_== 2) {
            $dts = $tdg->selectXUA("%".$palabra_."%");
        }else {
            if($opcion_== 3) {
                $dts = $tdg->selectXProponente("%".$palabra_."%");
            }
        }
    }
}
?>
<form name="frmBuscar" enctype="multipart/form-data" action="sisadpro.php?side=proy&content=buscar" method="POST">
    <br><br><br>
    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="80%">
        <tr>
            <td align='center'><font size="2" face="Verdana" color="#000000">
			Seleccione el tipo de b&uacute;squeda que desea realizar:</font><br><br>
                <select align="center" name="opcion" id="opcion">
                    <option></option>
                    <option value=1>Nombre de proyecto</option>
                    <option value=2>Unidad Acad&eacute;mica</option>
                    <option value=3>Proponente principal</option>
                </select>
            </td>
            <td align='center'><font size="2" face="Verdana" color="#000000">
			Digite el criterio de b&uacute;squeda:</font> <input name="palabra">
                <input type="submit"  value="Buscar" name="submit" />

            </td>
        </tr>
    </table><br><br>
    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="90%">
        <thead>
            <tr>
                <td align='center'width="34%"height="21">
                    <p style="margin-center: 10"><b><font size="2" face="Verdana" color="#000000">
				ID</font></b>
                </td>
                <td align='center'width="34%"height="21">
                    <p style="margin-center: 10"><b><font size="2" face="Verdana" color="#000000">
				Nombre</font></b>
                </td>
                <td align='center'width="34%"height="21">
                    <p style="margin-center: 10"><b><font size="2" face="Verdana" color="#000000">
				Proponente</font></b>
                </td>
                <td align='center'width="34%"height="21">
                    <p style="margin-center: 10"><b><font size="2" face="Verdana" color="#000000">
				Unidad Acad&eacute;mica</font></b>
                </td>

                <td align='center'width="33%" height="21">
                    <p style="margin-center: 10"><b><font face="Verdana" size="2" color="#000000">
				Descargar</font></b>
                </td>
            </tr>
        </thead>
        <tbody>
            <?php
            if($dts) {
                while($row = mysql_fetch_array($dts)) {
                    ?>
            <tr>
                <td width="34%" height="21">
                    <p style="margin-center: 10; margin-right: 10">
                        <font face="Verdana" size="1">
                                    <?php echo $row["IDProyecto"]; ?>
                        </font>
                </td>
                <td width="34%" height="21">
                    <p style="margin-center: 10; margin-right: 10">
                        <font face="Verdana" size="1">
                                    <?php echo $row["NombreP"]; ?>
                        </font>
                </td>
                <td width="34%" height="21">
                    <p style="margin-center: 10; margin-right: 10">
                        <font face="Verdana" size="1">
                                    <?php echo ($row["Nombre"].' '.$row["Apellido1"].' '.$row["Apellido2"]); ?>
                        </font>
                </td>
                <td width="34%" height="21">
                    <p style="margin-center: 10; margin-right: 10">
                        <font face="Verdana" size="1">
                                    <?php echo $row["UnidadAcademica"]; ?>
                        </font>
                </td>
                <td align='center'width="33%" height="21">
                    <p style="margin-center: 10"><font face="Verdana" size="1">
                            <a href="descargar.php?target=propuesta&fileId=<?php echo $row["IDPropuesta"]; ?>">
                                <img src='image/download-icon.png' width='30' height='30' border='0' alt='Descargar'>

                            </a></font>
                </td>
            </tr>
                <?php
                }
            }
            ?>
        </tbody>
    </table>
</form>

<table border="1">
    <thead>
        <tr>
            <th></th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td></td>
        </tr>
    </tbody>
</table>
